#!/usr/bin/env sh
printf '\e[34m *****Start install OBMessenger Frameworks!***** \e[0m \n'
cd `dirname $0`
if ! command -v carthage > /dev/null; then
printf '\e[33m This script will auto install Homebrew and Carthage. \e[0m \n'
if ! command -v brew > /dev/null; then
printf '\e[31m Homebrew is not installed. \e[0m \n \e[32m Installing Homebrew... \e[0m \n'
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
printf '\e[31m Carthage is not installed. \e[0m \n \e[32m Installing carthage... \e[32m \n'
brew install carthage
fi
rm -rf ./Carthage
printf '\e[32m *****Downloading...***** \e[0m \n'
curl -fsSL https://gitee.com/JasonGN/OB/raw/master/CarthageFW/fabricDownload > fabricDownload.sh
if [ ! -s Cartfile ]; then
curl -fsSL https://gitee.com/JasonGN/OB/raw/master/CarthageFW/Cartfile > Cartfile
fi
sh fabricDownload.sh
rm -f fabricDownload.sh
printf '\e[32m *****Setup...***** \e[0m \n'
carthage update --platform "iOS" --no-use-binaries
printf '\e[34m *****Install finish...***** \e[0m \n'
open ./Carthage/Build/iOS/
